package com.xiaozheng.captcha.demo;

import com.xiaozheng.captcha.demo.config.XzImageCaptchaApplication;
import cloud.tianai.captcha.generator.ImageCaptchaGenerator;
import cloud.tianai.captcha.spring.application.ImageCaptchaApplication;
import cloud.tianai.captcha.spring.autoconfiguration.ImageCaptchaProperties;
import cloud.tianai.captcha.spring.plugins.secondary.SecondaryVerificationApplication;
import cloud.tianai.captcha.spring.store.CacheStore;
import cloud.tianai.captcha.validator.ImageCaptchaValidator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;


@Slf4j
@Controller
@SpringBootApplication
public class CaptchaDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(CaptchaDemoApplication.class, args);
    }

    // @Bean
    // public ImageCaptchaApplication imageCaptchaApplication(ImageCaptchaGenerator captchaGenerator,
    //                                                        ImageCaptchaValidator imageCaptchaValidator,
    //                                                        CacheStore cacheStore,
    //                                                        ImageCaptchaProperties prop) {
    //     ImageCaptchaApplication target = new XzImageCaptchaApplication(captchaGenerator, imageCaptchaValidator, cacheStore, prop);
    //     if (prop.getSecondary() != null && Boolean.TRUE.equals(prop.getSecondary().getEnabled())) {
    //         target = new SecondaryVerificationApplication(target, prop.getSecondary());
    //     }
    //     return target;
    // }

}
